package com.maxmlr.music.user.service.impl;

import com.maxmlr.music.system.entity.Files;
import com.maxmlr.music.system.service.FilesService;
import com.maxmlr.music.user.entity.UserInfo;
import com.maxmlr.music.user.dao.UserInfoMapper;
import com.maxmlr.music.user.param.UserInfoParam;
import com.maxmlr.music.user.service.UserInfoService;
import com.maxmlr.music.common.base.BaseServiceImpl;
import com.maxmlr.music.user.service.transfer.UserInfoTransfer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author max
 * @version 1.0
 * @ClassName UserInfoServiceImpl
 * @Description  用户表  服务实现类
 * @Copyright Copyright (c) 2020: www.maxmlr.com.
 * @since 2020-06-14
 */
@Slf4j
@Service
public class UserInfoServiceImpl extends BaseServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService {

    @Autowired
    private FilesService filesService;

    @Autowired
    private UserInfoTransfer transfer;

    @Override
    public UserInfo getRequestUser() {
        return getById(1).setPassword("" );
    }

    @Override
    public UserInfoParam getRequestUserInfoParam() {
        UserInfo userInfo = getRequestUser();
        Files files = filesService.getById(userInfo.getHeadImgId());
        return transfer.po2UserInfoParam(userInfo, files.getUrl());
    }
}
